package com.example.maggie.meizinote.di.module;

import com.example.maggie.meizinote.mvp.ui.adapter.ColorSelectAdapter;
import com.jess.arms.di.scope.ActivityScope;

import dagger.Module;
import dagger.Provides;

import com.example.maggie.meizinote.mvp.contract.NoteEditContract;
import com.example.maggie.meizinote.mvp.model.NoteEditModel;


@Module
public class NoteEditModule {
    private NoteEditContract.View view;
    private ColorSelectAdapter adapter;

    /**
     * 构建NoteEditModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public NoteEditModule(NoteEditContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    NoteEditContract.View provideNoteEditView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    NoteEditContract.Model provideNoteEditModel(NoteEditModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    ColorSelectAdapter provideColorSelectAdapter() {
        if (adapter == null) adapter = new ColorSelectAdapter();
        return adapter;
    }
}